<!--公共开始-->
<include file="./public" />
<!--公共结束-->
<title>7min理财</title>
<script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=1.1&services=true"></script>
<script type="text/javascript" src="__ROOT__/js/baidu_map.js"></script>
<script type="text/javascript" src="__ROOT__/js/jquery.layer.js"></script>
<script type="text/javascript">
$(function() {
	baiduMap();
    $("#btnSendemail").click(function() 
    {
		 if(!checkEmpty("#txtUsername","#spanUsername","要写您的名字")){return false;}
		 if(!checkEmpty("#txtEmail","#spanEmail","要写您的联系方式")){return false;}
		 if(!checkEmpty("#txtContent","#spanContent","要写内容")){return false;}
		 var username = $("#txtUsername").val();
		 var email = $("#txtEmail").val();
		 var content = $("#txtContent").val();
		 sendEmail(username,email,content); 
    });
	
	$("#txtUsername").blur(function(){
		checkEmpty("#txtUsername","#spanUsername","要写您的名字")	
	});	
	$("#txtEmail").blur(function(){
		checkEmpty("#txtEmail","#spanEmail","要写您的联系方式")
	});
	$("#txtContent").blur(function(){
		checkEmpty("#txtContent","#spanContent","要写内容")	
	});
	$("#clearAll").click(function(){
		$("#txtUsername").val("");
		$("#txtEmail").val("");
		$("#txtContent").val("");
	})
})



//电子邮箱格式判断
function checkEmail(input,notice){
	var txtEmail=$(input).val();
	var reg =/([a-z0-9]*[-_\.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?/i;
	if (txtEmail == "" || txtEmail == null) {
		$(notice).html("<i class='fa fa-times-circle'></i>要写您的email地址</span>").show();	
		return false;
	}
	else if(!reg.test(txtEmail)){
		$(notice).html("<i class='fa fa-times-circle'></i>您的email地址格式不对</span>").show();	
		return false;
	}
	else{
		$(notice).html("").hide();	
		return true;
	}
}

//空值判断
function checkEmpty(input,notice,txt){
	var txtInput=$(input).val();
	if (txtInput == "" || txtInput == null) {
		$(notice).html("<i class='fa fa-times-circle'></i>"+txt+"</span>").show();	
		return false;		
	}
	else{
		$(notice).html("").hide();		
		return true;
	}
}

function sendEmail(username,email,content)
    {
           $.ajax({  
                    type: "post",  
                    url: "__URL__/contactUS",  
                    dataType: 'json',
                    data: {username:username,email:email,content:content},
                    beforeSend: function(XMLHttpRequest){  
                    },  
                    error:function(){
                        alert('error');
                    },
                    success: function(json)
                    {
                        //alert('success!');
                        if(json == 1){
                            //alert(json);
							$("#sendNotice").click();
                            //window.location.href='testResult/'+json.data['type'] +'/' +json.data['score'] ;
                        } else
                        {
                            alert('wrong!');
                        }
                    }                          
                })

    }
</script>
</head>

<body>
<!--头部+顶部开始-->
<include file="./top" />
<!--头部+顶部结束-->
<!--主体开始-->
<!--地图-->

<div class="main-content">
	<div class="contact">
        <div class="contact_top">
            <h1>联系我们</h1>
            <p>7分钟理财刚刚破茧重生，难免有很多疏漏的地方，您发现任何问题或有任何的建议，欢迎随时填写下方的表格，提交给我们。我们会有专人跟您直接联系，我们愿意为您而改变。</p>
        </div>
        <div class="left65 left">
        	<h2>你的名字</h2>
        	<p>
            	<input id="txtUsername" name="username" type="text" class="form-control" />
            	<span class="notice_wrong" id="spanUsername" style="display:none"><i class="fa fa-times-circle"></i>错误提示</span>
            </p>
            <h2>联系方式</h2>
        	<p>
                <input id="txtEmail" name="email" type="text" class="form-control" />
                <span class="notice_wrong" id="spanEmail" style="display:none"><i class="fa fa-times-circle"></i>错误提示</span>
            </p>
            <h2>内容</h2>
        	<p>
            	<textarea id="txtContent" name="content" cols="" rows="" class="form-control"></textarea>
            	<span class="notice_wrong" id="spanContent" style="display:none"><i class="fa fa-times-circle"></i>错误提示</span>
            </p>
            <p>
            	<input id="btnSendemail" name="" type="button" value="发送" class="btn btn-danger" />
            	<a data-reveal-id="sendEmail_notice" id="sendNotice" style="display:none">提示</a>
            </p>
        </div>
        <div class="right35 right">
            <h2>联系电话</h2>
            <p>010-84243961</p>
            <h2>社交互动</h2>
            <p>你可以关注我们的微信（订阅号：<span class="text-danger">www7mincomcn</span>）参与互动。</p>
            <h2>加入我们</h2>
            <p>欢迎有梦想，有冲劲的小伙伴加入我们，帮助老百姓更好地理财生活。<a href="__APP__/Index/hr">点这里！</a></p>
            <h2>官方邮箱</h2>
            <p><a href="mailto:7min@7min.com.cn">7min@7min.com.cn</a></p>
        </div>
        <div class="clear"></div>
        <div style="width:100%;height:300px;" id="dituContent"></div>
    </div>

</div>

<!--主体结束-->
<!--底部开始-->
<include file="./foot" />
<!--底部结束-->
<!--弹出层开始-->
<div id="sendEmail_notice" class="reveal-modal">
	<div class="panel-body">
    	<p>发送成功！^_^</p>
        <a href="javascript:void(0)" class="close-reveal-modal btn btn-danger btn-lg" id="clearAll">确 定</a>
    </div>
</div>
<!--弹出层结束-->

</body>
</html>
